package com.charley.icloud.office.realize;

import com.charley.icloud.office.enums.WordContentTypeEnum;
import com.charley.icloud.office.factory.GenerateWordFactory;
import com.charley.icloud.office.model.domain.LabelData;
import com.charley.icloud.office.model.domain.ListRenderData;
import com.charley.icloud.office.service.IGenerateWord;
import com.deepoove.poi.data.NumbericRenderData;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class ListGenerateWord implements IGenerateWord {
    @PostConstruct
    private void init(){
        GenerateWordFactory.register(WordContentTypeEnum.LIST,this);
    }
    @Override
    public Object generateWord(LabelData data) {
        ListRenderData listData =  (ListRenderData) data;
        return new NumbericRenderData(listData.getPair(),listData.getList());
    }
}
